#ifndef WOLF_FONT_HPP
#define WOLF_FONT_HPP

#include <string>

#include "common.hpp"
#include "color.hpp"

namespace wolf {
using namespace std;
/**
 * @brief An abstract font class that serves for anything writeable
 * @ingroup utilMod
 * @author Tales Miranda
 *
 * It has an basic interface that must be provided by the implementing the methods
 *  writeChar(), charWidth() and fontSize(). The first one, just put a char on
 *  the given surface. The second one returns the the number of pixel that the char
 *  needs to be showed, on the horizontal axis. And the last one returns the number of
 *  the pixel needed to show the a text line.
 *
 * Other methods use the three above on its standards implementations and can work
 *  fine without any change. But as they are generic ones, you could rewrite them to
 *  add a optimized behavor. Other good reason is to add a new functionality, like
 *  non-fixed height fonts (The default implementation is prepared to non-fixed width
 *  fonts because they are common, but not to non-fixed height).
 *
 **/
class Font {
public:
	/**
	 * @brief There is nothing to be destroyed, but it avoids warnings
	 **/
	virtual ~Font();

	/**
	 * @brief Writes a char on given surface
	 *
	 * Put a char on dst.
	 * @param c the char to be showed; It's interpretation depends on implementation. By default is UNICODE.
	 * @param dst the destiny surface;
	 * @param x the x position to put the char;
	 * @param y the y position to put the char;
	 * @param color The color to draw text.
	 **/
	virtual void writeChar(Uint16 c, SDL_Surface *dst, int x, int y,
			const Color & color) =0;

	/**
	 * @brief the width (in pixel) that a char need to be drawn
	 *
	 * The returned width must be deterministic, if you do not call an state changer method, the
	 *  returned value to a given char must be always the same.
	 *
	 * @param c The char;
	 **/
	virtual int charWidth(Uint16 c) const =0;

	/**
	 * @brief Return the size (vertical) of a line with the font
	 *
	 * The returned height must be deterministic. It means if you do not call an state changer method,
	 *  the returned value must be always the same.
	 *
	 **/
	virtual int fontSize() const =0;

	/**
	 * @brief The common font width
	 *
	 * The default is the width of 'm' letter
	 **/
	virtual int fontLength() const;

	/**
	 * @brief Returns the height of pixel
	 *
	 * The default behavor is return fontSize(). As this method is not called on writeText() method,
	 *  if you want to implement a non-fixed heigh font, you must override this and the writeText()
	 *  method;
	 * @see writeText();
	 *
	 * @param c the char.
	 **/
	virtual int charHeight(Uint16 c) const;

	/**
	 * @brief Writes a text on given surface
	 *
	 * The default behavior is call writeChar for each char of str (until reach '\0'!). It supposes
	 *  the font width may be variant. But the height is supposed to be fixed (during a call it is called
	 *  only once). If you want the lines or the with different heights, you must override it.
	 * @param str the string. It is supposed to be unicode UTF-8.
	 * @param dst the destination surface;
	 * @param x the x position;
	 * @param y the y position;
	 * @param color the color to render;
	 * @see charHeight(), charWidth()
	 **/
	virtual void writeText(const char *str, SDL_Surface *dst, int x, int y,
			const Color & color);

	/**
	 * @brief Writes a text on given surface
	 *
	 * It just accept std::string instead char*. But the default behavor is call writeText(const char*,...)
	 *   after an internal convertion from given string.
	 **/
	virtual void writeText(const string & str, SDL_Surface *dst, int x, int y,
			const Color & color);

	/**
	 * @brief Returns the width and height of the given string
	 *
	 *
	 **/
	virtual void textSize(const char *str, int & w, int & h);

	/**
	 * @brief Returns the width and height of the given string
	 *
	 *
	 **/
	virtual void textSize(const string & str, int & w, int & h);
};


}

#endif // WOLF_FONT_HPP
